package com.lwb.eduservice.controller;


import com.lwb.commonutils.Row;
import com.lwb.eduservice.entity.excel.OneSubject;
import com.lwb.eduservice.service.EduSubjectService;
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-11-16
 */
@RestController
@RequestMapping("/eduservice/edu-subject")
public class EduSubjectController {

    @Autowired
    private EduSubjectService eduSubjectService;

    //添加课程分类
    @PostMapping("addSubject")
    public Row addSubject(MultipartFile file){
        eduSubjectService.addSubject(file,eduSubjectService);
        return Row.SUCCESS();
    }

    //显示课程分类列表
    @GetMapping("findAllSubject")
    public Row findAllSubject(){
        List<OneSubject> list = eduSubjectService.findAllSubject();
        return Row.SUCCESS().data("list",list);
    }



}

